package fr.vvins.core.user.entity;



import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import fr.vvins.core.dao.EntityImpl;

/**
 * Role entity
 */
@Entity
@Table(schema="vvins", name="VV_ROLE")
public class Role extends EntityImpl implements Serializable {

	private static final long serialVersionUID = 1242250053327176837L;
	@Id
	@GeneratedValue
	@Column(name="ID")
	private Integer id;
	@ManyToOne
	@JoinColumn(name="PARENT_ROLE_ID")
	private Role parentRoles;
	@Basic
	@Column(name="NAME")
	private String name;
	@OneToMany(mappedBy="parentRoles")
	private Set<Role> childRoles = new HashSet<Role>(0);

	public Role() {
	}

	public Role(Integer id, Role parentRoles, String name, Set<Role> childRoles) {
		super();
		this.id = id;
		this.parentRoles = parentRoles;
		this.name = name;
		this.childRoles = childRoles;
	}

	@Override
	public Integer getId() {
		return id;
	}

	@Override
	public void setId(Integer id) {
		this.id = id;
	}

	public Role getParentRoles() {
		return parentRoles;
	}

	public void setParentRoles(Role parentRoles) {
		this.parentRoles = parentRoles;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Set<Role> getChildRoles() {
		return childRoles;
	}

	public void setChildRoles(Set<Role> childRoles) {
		this.childRoles = childRoles;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	

}
